package com.hippo4j.executor;

import com.hippo4j.plugin.manager.DefaultThreadPoolPluginManager;
import com.hippo4j.plugin.manager.DefaultThreadPoolPluginRegister;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

public class DynamicThreadPoolExecutor extends ExtensibleThreadPoolExecutor {


    public DynamicThreadPoolExecutor(String threadPoolId, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler, boolean allowCoreThreadTimeOut) {
        super(threadPoolId, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler, new DefaultThreadPoolPluginManager());
        //注册内置的一些插件
        new DefaultThreadPoolPluginRegister().doRegister(this);

        super.allowCoreThreadTimeOut(allowCoreThreadTimeOut);
    }
}
